import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";

export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "src"),
    },
  },
  server: {
    proxy: {
      // 选项写法
      "/api": {
        target: "http://localhost:8082", // 目标API服务器的地址
        changeOrigin: true, // 如果目标API服务器需要根据域名来区分来源，需要设置为true
        rewrite: (path) => path.replace(/^\/api/, ""), // 重写路径
      },
    },
  },
});
